package com.storydo.file.share.config;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import lombok.Data;

@Data
@Component
@ConfigurationProperties(prefix = "file")
public class FileConfiguration {

	// 可供下载的目录
	private String path;
	
	private int fileSize;
	
	private Path workPath;
	
	// 是否允许上传文件
	private boolean upload;
	
	private boolean auth;
	
	public Path getWorkPath() {
		if (this.workPath == null) {			
			this.workPath = Paths.get(this.path).toAbsolutePath().normalize();
		}
		return this.workPath;
	}
	
}
